package mtn.bowen.yan.server.enums;

/**
 * @author <a href=mailto:yanbowen90@foxmail.com> bowen.yan </a>
 * @version 1.0
 * @description: Types of Dishes
 * @date 2021-10-24 8:05 AM
 */
public enum DishesTypeEnum {

    /*** 早餐 */
    BREAKFAST(1, "早餐"),
    /*** 午餐 */
    LUNCH(2, "午餐"),
    /*** 晚餐 */
    DINNER(3, "晚餐"),
    /*** 未知分类 */
    UNKNOWN(99, "未知分类"),
    ;

    DishesTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static DishesTypeEnum getDishesType(String msg) {
        for (DishesTypeEnum value : values()) {
            if (value.getMsg().equals(msg)) {
                return value;
            }
        }
        return UNKNOWN;
    }

    public static DishesTypeEnum getDishesType(Integer code) {
        for (DishesTypeEnum value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return UNKNOWN;
    }

    private Integer code;
    private String msg;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
